// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import App from './App'
import Vuex from 'vuex'
import vuexI18n from 'vuex-i18n'
import router from './router'
import axios from 'axios'
import { sync } from 'vuex-router-sync'

/** ConfirmPlugin **/
import { ConfirmPlugin } from 'vux'
Vue.use(ConfirmPlugin)

/** axios **/
axios.defaults.baseURL = process.env.DATA_API
Vue.prototype.$axios = axios

/** Vuex **/
Vue.use(Vuex)

/** i18n **/
let store = new Vuex.Store({
  modules: {
    i18n: vuexI18n.store
  }
})
store.registerModule('vux', {
  state: {
    direction: 'forward'
  }
})
Vue.use(vuexI18n.plugin, store)
sync(store, router)

/** 消除点击延迟 **/
FastClick.attach(document.body)

/** 时间格式化 **/
Vue.filter('time', timestamp => {
  return new Date(timestamp).toLocaleTimeString()
})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app-box')
